//
// Created by yewei on 2023/1/4.
//
#include <bits/stdc++.h>

using namespace std;

int main() {
    freopen("../input.txt", "r", stdin);
    int T;
    cin>>T;
    int n,m,k,now,target,cnt;
    while(T--){
        cin>>n>>m>>k;
        bool flag[n+1];
        for(int i=1;i<=n;i++) flag[i] = false;
        vector<int> res;
        cnt = n;
        target = 0;
        while(cnt--){
            int i=0;
            while(i<m){
                target++;
                target %= n;
                if(target==0) target=n;
                if(!flag[target]) i++;
            }
            res.push_back(target);
            flag[target] = true;
        }
        cout<<res[k-1]<<endl; //注意res数组从下标0开始存储
    }
}
